package com.dreamteam.schooling;

import android.app.*;
import android.content.*;
import android.content.res.*;
import android.os.*;
import android.view.*;
import android.widget.*;

import com.dreamteam.schooling.classsearch.*;
import com.dreamteam.schooling.setting.*;
import com.dreamteam.schooling.timetable.*;


public class TabMenuBarActivity extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab_menu_bar);

		Resources res = getResources();

		LayoutInflater inflater = getLayoutInflater();
		ViewGroup vg = (ViewGroup)inflater.inflate(R.layout.tab_item, null, false);
		TextView tv = (TextView)vg.findViewById(R.id.tab_name);

		String[] arrays = res.getStringArray(R.array.tab_items);


		TabHost tabHost = getTabHost();

		tabHost.addTab(tabHost.newTabSpec("HOME")
				.setIndicator(new TabButton(this, R.drawable.btn_tap1_selector, arrays[0]))
				.setContent(new Intent(this, MainActivity.class)));

		tabHost.addTab(tabHost.newTabSpec("TimeTable")
				.setIndicator(new TabButton(this, R.drawable.btn_tap2_selector, arrays[1]))
				.setContent(new Intent(this, TimeTableSettingActivity.class)));

		tabHost.addTab(tabHost.newTabSpec("ClassBoard")
				.setIndicator(new TabButton(this, R.drawable.btn_tap3_selector, arrays[2]))
				.setContent(new Intent(this,MainActivity.class)));

		tabHost.addTab(tabHost.newTabSpec("ClassSearch")
				.setIndicator(new TabButton(this, R.drawable.btn_tap4_selector, arrays[3]))
				.setContent(new Intent(this, ClassSearch.class)));

		tabHost.addTab(tabHost.newTabSpec("Setting")
				.setIndicator(new TabButton(this, R.drawable.btn_tap5_selector, arrays[4]))
				.setContent(new Intent(this, SettingMenuActivity.class)));

	}

	public class TabButton extends TextView {
		public TabButton(Context context, int id, String text) {
			super(context);
			this.setBackgroundDrawable(context.getResources().getDrawable(id));
			this.setText(text);
			this.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL);
			this.setTextSize(10);
		}
	}

}
